﻿#region Usings

using System.Xml.XPath;

#endregion

namespace Kazkommertsbank.Framework.Model.OrderStatus
{
    public class OrderStatusBank
    {
        private readonly string _xml;

        public OrderStatusBank(XPathNavigator nav)
        {
            _xml = nav.OuterXml;
            Name = nav.GetAttribute("name", "");
            Callcenter = nav.GetAttribute("callcenter", "");

            XPathNavigator navigator = nav.SelectSingleNode("merchant");
            if(navigator != null)
                Merchant = new OrderStatusMerchant(navigator);

            navigator = nav.SelectSingleNode("response");
            if(navigator != null)
                Response = new OrderStatusResponse(navigator);
        }

        public string Name { get; set; }
        public string Callcenter { get; set; }
        public OrderStatusMerchant Merchant { get; set; }
        public OrderStatusResponse Response { get; set; }

        public string ToXmlString()
        {
            return _xml;
        }
    }
}